package com.wf.service.impl;

import com.wf.mapper.GoodsMapper;
import com.wf.pojo.Goods;
import com.wf.service.GoodsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public Goods getById(Long goodsId) {
        Goods goods = goodsMapper.selectById(goodsId);
        return goods;

    }

    @Override
    public void insert(Goods goods) {
        goodsMapper.insert(goods);
    }

    @Override
    public void update(Goods goods) {

        goodsMapper.updateById(goods);
    }

    /**
     * 修改状态
     * @param id
     * @param status
     */
    public void updateByStatus(Long id, Integer status) {
        Goods goods = new Goods();
        goods.setId(id);
        goods.setStatus(status);
        goodsMapper.updateById(goods);
        log.info("状态："+goodsMapper.updateById(goods));

    }


}
